<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>z-index的应用</title>
    <style>
        .f{
            border: 1px solid #000;
        }
        .f .s{
            margin: 10px;
            width: 100px;
            height: 100px;
            border: 1px solid #000;
        }
        .f .s1{
            background-color: #f00;
            position: relative;
            z-index: 5;
        }
        .f .s2{
            position: relative;
            top: -30px;
            left: 20px;
            background-color: #0f0;
            z-index: 3;
        }
    </style>
</head>
<body>
    <div class="f">
        <div class="s s1"></div>
        <div class="s s2"></div>
        <div class="s s3"></div>
    </div>
</body>
</html>